import { bindCustomEditing, ESJEditingMode, extendClassProps, reactArray, reactArrayWithUndefined, SceneObjectKey, UniteChanged } from "earthsdk3"
import { ESGeoExtrudedPolygonUFMS } from "../ESGeoExtrudedPolygonUFMS";
/**
 * 测试 ModelSer使用的挤压多边形体
 */
export class ESGeoExtrudedPolygonUFMSFromCircle extends ESGeoExtrudedPolygonUFMS {
    static override readonly type:string = this.register('ESGeoExtrudedPolygonUFMSFromCircle', this, { chsName: 'ModelSer使用的地理多边形体', tags: ['ESObjects', '_ES_Impl_Cesium', '_ES_Impl_UE'], description: "地理多边形体" });

    static override supportEditingModes: string[] = [
        ESJEditingMode.Place,
        ESJEditingMode.Translation

    ];
    override updateEditing(): void {
        if (!this.positionEditing) return;
        const editingModes: ESJEditingMode[] = [];
        if (!this.points || this.points.length <= 0) {
            editingModes.push(ESJEditingMode.Place);
        }
        editingModes.push(ESJEditingMode.Translation);
        this.activeViewer?.startEditing(this, editingModes, { callSource: "inner" });
    }
    static override defaults = {
        ...ESGeoExtrudedPolygonUFMS.defaults,
        radius: 1,
        sides: 4
    }

    constructor(id?: SceneObjectKey) {
        super(id);
        this.collision = false;
        bindCustomEditing(this, this.updateEditing, 'positionEditing');

    }
}

export namespace ESGeoExtrudedPolygonUFMSFromCircle {
    export const createDefaultProps = () => ({
        ...ESGeoExtrudedPolygonUFMS.createDefaultProps(),
        sides: undefined as number | undefined,
        radius: undefined as number | undefined,
        position: reactArrayWithUndefined<[number, number, number]>(undefined),
        rotation: reactArray<[number, number, number]>([0, 0, 0]),
        positionEditing: false,
    });
}
extendClassProps(ESGeoExtrudedPolygonUFMSFromCircle.prototype, ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps);
export interface ESGeoExtrudedPolygonUFMSFromCircle extends UniteChanged<ReturnType<typeof ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps>> { }